AC_PREREQ([2.65])
AC_INIT(ms2sim, 0.1, cezanne@clunix.com)
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([src/ms2sim/ms2sim.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE

AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [enable debug mode]),
AC_DEFINE([MSM_DEBUG], [], [enable MSM debug mode])
AC_DEFINE([ECM_DEBUG], [], [enable ECM debug mode])
MSM_DEBUG=yes
,
)

LT_INIT([dlopen])

# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lECM':
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([gsl], [main], [true], [echo "GSL library required"], [cblas])
AC_CHECK_LIB([ECM], [main])

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T

# Checks for library functions.

AC_CONFIG_FILES([Makefile
                lib/Makefile
                src/Makefile
		src/ms2sim/Makefile
		src/ms2lstat/Makefile
		src/ms2wgen/Makefile
		src/ms2check/Makefile
		src/dperf/Makefile
		modules/Makefile])

AC_OUTPUT
